﻿using Blm.Utils.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using VisionCloud.Domain.Common;
using VisionCloud.Utility.Extensions;

namespace VisionCloud.Domain.DtoModel.Ms
{
    /// <summary>
    /// 项目进度信息统计模型
    /// </summary>
    public class ProjectProgressStatisDto
    {
        public Guid ProjectId { get; set; }
        public string ProjectName { get; set; }
        public string BuildingName { get; set; }
        public string FloorNum { get; set; }
        public DateTime? StructuralFirstDateTime { get; set; }
        public DateTime? StructuralSecondDateTime { get; set; }
        public DateTime? PlasterFirstDateTime { get; set; }
        public DateTime? MasonryFirstDateTime { get; set; }

        /// <summary>
        /// 装饰工程初测时间
        /// </summary>
        public DateTime? DecorateFirstDateTime { get; set; }
        /// <summary>
        /// 装饰工程复测时间
        /// </summary>
        public DateTime? DecorateSecondDateTime { get; set; }
        public decimal? MeasureArea { get; set; }
    }

    /// <summary>
    /// 楼栋与楼层信息已经测量信息与状态
    /// </summary>
    public class BuildingInfo
    {
        /// <summary>
        /// 统计主键
        /// </summary>
        public string InfoKey
        {
            get
            {
                return $"{ProjectId}-{BuildingName}-{FloorNum}-{TaskType}-{Stage}-{TaskProperty}";
            }
        }

        /// <summary>
        /// 项目ID
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 楼栋编号
        /// </summary>
        public string BuildingName { get; set; }

        public string ProjectName { set; get; }
        ///// <summary>
        ///// 楼层总数
        ///// </summary>
        //public int FloorCount { get; set; }

        /// <summary>
        /// 楼层
        /// </summary>
        public int FloorNum { get; set; }

        /// <summary>
        /// 户型图面积
        /// </summary>
        public double MapArea { get; set; }

        /// <summary>
        /// 结构工程初测时间
        /// </summary>
        public DateTime? StructuralFirstDateTime { get; set; }

        /// <summary>
        /// 结构工程复测时间
        /// </summary>
        public DateTime? StructuralSecondDateTime { get; set; }

        /// <summary>
        /// 抹灰工程初测时间
        /// </summary>
        public DateTime? PlasterFirstDateTime { get; set; }

        public DateTime? PlasterSecondDateTime { get; set; }

        /// <summary>
        /// 砌筑工程初测时间
        /// </summary>
        public DateTime? MasonryFirstDateTime { get; set; }

        public DateTime? MasonrySecondDateTime { get; set; }

        /// <summary>
        /// 装饰工程初测时间
        /// </summary>
        public DateTime? DecorateFirstDateTime { get; set; }
        /// <summary>
        /// 装饰工程复测时间
        /// </summary>
        public DateTime? DecorateSecondDateTime { get; set; }

        /// <summary>
        /// 已经测量完成的面积：已测量的站点数除以户型图总站点数乘以户型图面积
        /// </summary>
        public double CompletedArea { set; get; }

        /// <summary>
        /// 任务类型
        /// </summary>
        public int? TaskType { set; get; }
        public string TaskProperty { set; get; }
        /// <summary>
        /// 阶段
        /// </summary>
        public string Stage { set; get; }
    }

    public static class DateTimeNullableExt
    {
        public static string GetTimeString(this DateTime? dateTime)
        {
            if (dateTime.HasValue)
            {
                return dateTime.ToString();
            }
            else
                return string.Empty;
        }
    }

    public class MeasureStepDetail
    {
        public string MeasureStep { set; get; }
        public double MeasuredPercent { set; get; }
        public int MeasuredFloorCount { set; get; }
        /// <summary>
        /// 累加的会出现精度问题
        /// </summary>
        private double measuredArea { set; get; }
        public double MeasuredArea
        {
            set { measuredArea = value; }
            get
            {
                return Math.Round(measuredArea, 2);
            }
        }
    }

    /// <summary>
    /// 楼栋进度
    /// </summary>
    public class DetailProgress : Detail
    {
        /// <summary>
        /// 已经测量的楼层数量
        /// </summary>
        public int MeasuredFloorCount { get; set; }

        /// <summary>
        /// 结构工程已经完成初测的楼层列表
        /// </summary>
        public List<int> FloorStructFirstTime { get; set; } = new List<int>();

        /// <summary>
        /// 结构工程已经完成复测的楼层列表
        /// </summary>
        public List<int> FloorStructSecondTime { get; set; } = new List<int>();

        /// <summary>
        /// 抹灰工程初测已经完成初测的楼层列表
        /// </summary>
        public List<int> FloorPlasterFirstDateTime { get; set; } = new List<int>();

        /// <summary>
        /// 抹灰工程复测已经完成初测的楼层列表
        /// </summary>
        public List<int> FloorPlasterSecondDateTime { get; set; } = new List<int>();

        /// <summary>
        /// 砌筑工程初测楼层列表
        /// </summary>
        public List<int> FloorMasonryFirstDateTime { get; set; } = new List<int>();

        /// <summary>
        /// 砌筑工程复测楼层列表
        /// </summary>
        public List<int> FloorMasonrySecondDateTime { get; set; } = new List<int>();

        /// <summary>
        /// 装饰工程初测楼层列表
        /// </summary>
        public List<int> FloorDecorateFirstDateTime { get; set; } = new List<int>();

        /// <summary>
        /// 装饰工程复测楼层列表
        /// </summary>
        public List<int> FloorDecorateSecondDateTime { get; set; } = new List<int>();
    }

    /// <summary>
    /// 项目进度数据
    /// </summary>
    public class ProjectProgressAnalysisDto
    {
        #region 项目表数据

        /// <summary>
        /// 项目ID
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目编号
        /// </summary>
        public string ProjectNo { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 项目楼栋与楼层的信息，来自项目表
        /// </summary>
        public List<DetailProgress> DetailInfo { get; set; }

        private double _totalArea;
        /// <summary>
        /// 项目总面积
        /// </summary>
        public double TotalArea
        {
            get
            {
                if (_totalArea > 0)
                {
                    return _totalArea * ProjectMeasureStepCount * TaskTypeCount;
                }
                else
                {
                    return 0;
                }
                //else if (FloorSum == 0 || BuildingInfos == null || BuildingInfos.Count < 1)
                //{
                //    _totalArea = 0;

                //}
                //else
                //{
                //    _totalArea = FloorSum * BuildingInfos.Select(x => x.MapArea).Sum() * ProjectMeasureStepCount * TaskTypeCount;

                //}
                //return _totalArea;
            }
            set
            {
                _totalArea = value;
            }
        }

        /// <summary>
        /// 项目测量阶段
        /// </summary>
        public List<ProjectMeasureStepEnum> ProjectMeasureSteps { get; set; } = new List<ProjectMeasureStepEnum>();

        public int ProjectMeasureStepCount
        {
            get { return ProjectMeasureSteps.Count; }
        }

        /// <summary>
        /// 任务类型数量
        /// 获取前端传过来的TaskCount.Count()
        /// </summary>
        public int TaskTypeCount { get; set; }

        #endregion 项目表数据

        #region 来自项目表的detail的楼栋与楼层的统计数据

        /// <summary>
        /// 所有楼栋总数
        /// </summary>
        public int BuildingCountSum
        {
            get
            {
                if (DetailInfo != null)
                {
                    return DetailInfo.Count();
                }
                else
                {
                    return 0;
                }
            }
        }

        /// <summary>
        /// 所有楼栋的楼层总和
        /// </summary>
        public int FloorSum
        {
            get
            {
                int sum = 0;
                if (DetailInfo != null)
                {
                    DetailInfo.ForEach(p => sum += p.Floor.ToInt32());
                    return sum;
                }
                else
                {
                    return 0;
                }
            }
        }

        #endregion 来自项目表的detail的楼栋与楼层的统计数据

        #region 项目楼栋与楼层测量情况

        /// <summary>
        /// 项目的楼栋与楼层已经测量的信息，来自MsSProgressAnalysis测量进度表的统计数据
        /// 需要确保：（楼栋+楼层）-只有一条记录,SetStatisToBuildingInfos
        /// </summary>
        public List<BuildingInfo> BuildingInfos { get; set; }

        /// <summary>
        /// 维护楼栋楼层测量信息
        /// </summary>
        /// <param name="buildingInfo"></param>
        public void SetStatisToBuildingInfos(BuildingInfo buildingInfo)
        {
            if (BuildingInfos == null)
            {
                BuildingInfos = new List<BuildingInfo>();
            }
            //当前楼栋的详细进度信息
            var projectDetailProgress = DetailInfo.FirstOrDefault(p => p.Building == buildingInfo.BuildingName);

            var info = BuildingInfos.FirstOrDefault(p => p.InfoKey == buildingInfo.InfoKey);
            if (info == null)
            {
                BuildingInfos.Add(buildingInfo);
            }
            info = BuildingInfos.FirstOrDefault(p => p.InfoKey == buildingInfo.InfoKey);
            if (buildingInfo.StructuralFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构初测))
            {
                info.StructuralFirstDateTime = buildingInfo.StructuralFirstDateTime;
                if (!projectDetailProgress.FloorStructFirstTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorStructFirstTime.Add(info.FloorNum);
                }
            }
            if (buildingInfo.StructuralSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构复测))
            {
                info.StructuralSecondDateTime = buildingInfo.StructuralSecondDateTime;
                if (!projectDetailProgress.FloorStructSecondTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorStructSecondTime.Add(info.FloorNum);
                }
            }
            if (buildingInfo.PlasterFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰初测))
            {
                info.PlasterFirstDateTime = buildingInfo.PlasterFirstDateTime;
                if (!projectDetailProgress.FloorPlasterFirstDateTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorPlasterFirstDateTime.Add(info.FloorNum);
                }
            }
            if (buildingInfo.PlasterSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰复测))
            {
                info.PlasterSecondDateTime = buildingInfo.PlasterSecondDateTime;
                if (!projectDetailProgress.FloorPlasterSecondDateTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorPlasterSecondDateTime.Add(info.FloorNum);
                }
            }

            if (buildingInfo.MasonryFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑初测))
            {
                info.MasonryFirstDateTime = buildingInfo.MasonryFirstDateTime;
                if (!projectDetailProgress.FloorMasonryFirstDateTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorMasonryFirstDateTime.Add(info.FloorNum);
                }
            }

            if (buildingInfo.MasonrySecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑复测))
            {
                info.MasonrySecondDateTime = buildingInfo.MasonrySecondDateTime;
                if (!projectDetailProgress.FloorMasonrySecondDateTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorMasonrySecondDateTime.Add(info.FloorNum);
                }
            }
            if (buildingInfo.DecorateFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰初测))
            {
                info.MasonrySecondDateTime = buildingInfo.MasonrySecondDateTime;
                if (!projectDetailProgress.FloorDecorateFirstDateTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorDecorateFirstDateTime.Add(info.FloorNum);
                }
            }
            if (buildingInfo.DecorateSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰复测))
            {
                info.MasonrySecondDateTime = buildingInfo.MasonrySecondDateTime;
                if (!projectDetailProgress.FloorDecorateSecondDateTime.Contains(info.FloorNum))
                {
                    projectDetailProgress.FloorDecorateSecondDateTime.Add(info.FloorNum);
                }
            }
        }

        #endregion 项目楼栋与楼层测量情况

        /// <summary>
        /// 项目已经测量面积总和
        /// </summary>
        public double MeasuredAreaSum
        {
            get
            {
                double sum = 0;
                if (BuildingInfos != null)
                {
                    foreach (var info in BuildingInfos)
                    {
                        if (info.StructuralFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构初测))//已经进行结构初测
                        {
                            sum += info.CompletedArea;
                        }

                        if (info.StructuralSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构复测))//已经进行结构复测
                        {
                            sum += info.CompletedArea;
                        }

                        if (info.PlasterFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰初测))//已经进行抹灰工程初测
                        {
                            sum += info.CompletedArea;
                        }
                        if (info.PlasterSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰复测))
                        {
                            sum += info.CompletedArea;
                        }
                        if (info.MasonryFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑初测))//已经进行砌筑工程初测
                        {
                            sum += info.CompletedArea;
                        }
                        if (info.MasonrySecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑复测))
                        {
                            sum += info.CompletedArea;
                        }
                        if (info.DecorateFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰初测))
                        {
                            sum += info.CompletedArea;
                        }
                        if (info.DecorateSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰复测))
                        {
                            sum += info.CompletedArea;
                        }
                    }
                }
                return sum;
            }
        }

        /// <summary>
        /// 项目已经测量的楼层总和
        /// </summary>
        public decimal? MeasuredFloorSum
        {
            get
            {
                decimal sum = 0;

                if (BuildingInfos != null)
                {
                    foreach (var info in BuildingInfos)
                    {
                        if (info.StructuralFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构初测))//已经进行结构初测
                        {
                            sum += 1;
                        }

                        if (info.StructuralSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构复测))//已经进行结构复测
                        {
                            sum += 1;
                        }

                        if (info.PlasterFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰初测))//已经进行抹灰工程初测
                        {
                            sum += 1;
                        }
                        if (info.PlasterSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰复测))
                        {
                            sum += 1;
                        }
                        if (info.MasonryFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑初测))//已经进行砌筑工程初测
                        {
                            sum += 1;
                        }
                        if (info.MasonrySecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑复测))
                        {
                            sum += 1;
                        }
                        if (info.DecorateFirstDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰初测))
                        {
                            sum += 1;
                        }
                        if (info.DecorateSecondDateTime.HasValue && ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰复测))
                        {
                            sum += 1;
                        }
                    }
                }

                return sum;
            }
        }

        #region 项目阶段进度

        public List<MeasureStepDetail> MeasureStepDetails
        {
            get
            {
                List<MeasureStepDetail> measureStepDetails = new List<MeasureStepDetail>();
                if (BuildingInfos == null || BuildingInfos.Count < 1) // 因为没有数据也要显示啊
                {
                    ProjectMeasureSteps.ForEach(m =>
                    {
                        measureStepDetails.Add(new MeasureStepDetail
                        {
                            MeasureStep = m.ToString(),
                            MeasuredFloorCount = 0,
                        });
                    });
                }
                else
                {
                    BuildingInfos.ForEach(b =>
                    {
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构初测))
                        {
                            int floor = b.StructuralFirstDateTime.HasValue ? 1 : 0;
                            double mapArea = b.StructuralFirstDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.结构初测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.结构初测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.结构复测))
                        {
                            int floor = b.StructuralSecondDateTime.HasValue ? 1 : 0;
                            double mapArea = b.StructuralSecondDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.结构复测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.结构复测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰初测))
                        {
                            int floor = b.PlasterFirstDateTime.HasValue ? 1 : 0;
                            double mapArea = b.PlasterFirstDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.抹灰初测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.抹灰初测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.抹灰复测))
                        {
                            int floor = b.PlasterSecondDateTime.HasValue ? 1 : 0;
                            double mapArea = b.PlasterSecondDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.抹灰复测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.抹灰复测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑初测))
                        {
                            int floor = b.MasonryFirstDateTime.HasValue ? 1 : 0;
                            double mapArea = b.MasonryFirstDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.砌筑初测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.砌筑初测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.砌筑复测))
                        {
                            int floor = b.MasonrySecondDateTime.HasValue ? 1 : 0;
                            double mapArea = b.MasonrySecondDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.砌筑复测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.砌筑复测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰初测))
                        {
                            int floor = b.DecorateFirstDateTime.HasValue ? 1 : 0;
                            double mapArea = b.DecorateFirstDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.装饰初测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.装饰初测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                        if (ProjectMeasureSteps.Contains(ProjectMeasureStepEnum.装饰复测))
                        {
                            int floor = b.DecorateSecondDateTime.HasValue ? 1 : 0;
                            double mapArea = b.DecorateSecondDateTime.HasValue ? b.CompletedArea : 0;
                            var measured = measureStepDetails.FirstOrDefault(a => a.MeasureStep == ProjectMeasureStepEnum.装饰复测.ToString());
                            if (measured != null)
                            {
                                measured.MeasuredFloorCount += floor;
                                measured.MeasuredArea += mapArea;
                            }
                            else
                            {
                                measureStepDetails.Add(new MeasureStepDetail
                                {
                                    MeasureStep = ProjectMeasureStepEnum.装饰复测.ToString(),
                                    MeasuredFloorCount = floor,
                                    MeasuredArea = mapArea
                                });
                            }
                        }
                    });
                }
                measureStepDetails.ForEach(m =>
                {
                    if (FloorSum == 0 || TotalArea == 0)
                    {
                        m.MeasuredPercent = 0;
                        m.MeasuredArea = 0;
                    }
                    else
                    {
                        double result = m.MeasuredArea / TotalArea * 100 * ProjectMeasureStepCount;
                        m.MeasuredPercent = Math.Round(result, 2);
                    }
                });
                return measureStepDetails;
            }
        }

        #endregion 项目阶段进度

        /// <summary>
        /// 项目进度-总体已测量面积百分比
        /// </summary>
        public double SumPercent
        {
            get
            {
                if (TotalArea > 0 && MeasuredAreaSum > 0)
                {
                    return Math.Round(MeasuredAreaSum / TotalArea * 100, 2);
                }
                else
                    return 0;
            }
        }
    }
}